<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" id="i1">
<input type="button" value="靓仔" onclick="f(1)">
<input type="button" value="美铝" onclick="f(2)">

<script>
    function f(number) {
      let a= number==1 ?"../gxs02.png":"../fbb.jpg";

        for (let i=0 ; i<i1.value;i++) {
            //创建图片标签
            let b = document.createElement("img");
            // 设置图片的src属性
            b.src = a;
            //设置图片宽度
            b.width = 300;
            //把图片添加到页面中
            document.body.append(b);
        }
    }
</script>
</body>
</html>